package thread5;

class SingletonLazy {
    private static volatile SingletonLazy instance = null;
    private SingletonLazy() { }
    public static SingletonLazy getInstance() {
        if (instance == null) {//跳锁，instance都非空时 不加锁地 随意让它们碎处理都行
            synchronized (SingletonLazy.class) {//加锁，instance都为空时 锁成块地排序 执行
                if (instance == null) {
                    instance = new SingletonLazy();
                }
            }
        }
        return instance;
    }
}

public class Demo22 {
    public static void main(String[] args) {
        
    }
}
